<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        #box {
            width: 400px;
            height: 200px;
            border: 1px solid red;
            position: relative;
            margin: 20px auto;
            background: black;
        }
        
        .ball {
            width: 50px;
            height: 50px;
            border-radius: 50%;
            position: absolute;
        }
        
        .ball:nth-of-type(1) {
            background: red;
            left: 350px;
            top: 50px;
        }
        
        .ball:nth-of-type(2) {
            background: blue;
            left: 175px;
            top: 75px;
        }
        
        .ball:nth-of-type(3) {
            background: green;
            left: 0;
            top: 50px;
        }
        
        .ball:nth-of-type(4) {
            background: pink;
            left: 175px;
            top: 0;
        }
    </style>
</head>

<body>
    <div id="box">
        <div class="ball"></div>
        <div class="ball"></div>
        <div class="ball"></div>
        <div class="ball"></div>
    </div>
</body>
<script>
    onload = function(){
    	var box = document.getElementById("box");
    	
    	var dargee1 = 0;
		setInterval(function(){
			box.children[0].style.left = 180 + 180*Math.cos(dargee1*Math.PI/180) + "px";
			box.children[0].style.top = 80 + 80*Math.sin(dargee1*Math.PI/180) + "px";
			box.children[0].style.height = box.children[0].style.width = box.children[0].offsetTop * 0.3 + 50 + "px";   		
			dargee1++;
		},10);
		var dargee2 = 90;
		setInterval(function(){
			box.children[1].style.left = 180 + 180*Math.cos(dargee2*Math.PI/180) + "px";
			box.children[1].style.top = 80 + 80*Math.sin(dargee2*Math.PI/180) + "px";
			box.children[1].style.height = box.children[1].style.width = box.children[1].offsetTop * 0.3 + 50 + "px";   		
			dargee2++;
		},10);
		var dargee3 = 180;
		setInterval(function(){
			box.children[2].style.left = 180 + 180*Math.cos(dargee3*Math.PI/180) + "px";
			box.children[2].style.top = 80 + 80*Math.sin(dargee3*Math.PI/180) + "px";
			box.children[2].style.height = box.children[2].style.width = box.children[2].offsetTop * 0.3 + 50 + "px";   		
			dargee3++;
		},10);
		var dargee4 = 270;
		setInterval(function(){
			box.children[3].style.left = 180 + 180*Math.cos(dargee4*Math.PI/180) + "px";
			box.children[3].style.top = 80 + 80*Math.sin(dargee4*Math.PI/180) + "px";
			box.children[3].style.height = box.children[3].style.width = box.children[3].offsetTop * 0.3 + 50 + "px";   		
			dargee4++;
		},10);

    }
</script>

</html>